package io.objectoutputstream;

import java.io.File;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.List;

public class Demo01ObjectOutPutStream {
    public static void main(String[] args) throws Exception {
        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(new File("F://Test//T4//write.txt")));
//        oos.writeObject(new Person("靳海含", 21));
//        oos.writeObject(new Person("封观兰", 20));
//        oos.writeObject(new Person("迪丽热巴", 27));

        List<Person> list = new ArrayList<>();
        list.add(new Person("靳海含", 21));
        list.add(new Person("封观兰", 20));
        list.add(new Person("迪丽热巴", 27));

        oos.writeObject(list);
    }
}
